package com.ctshk.rpc.order.scenic.manager;

import java.time.LocalDate;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.Random;

/**
 * 门票管理类
 */
public class ScenicOrderManager {

    /**
     * 获取订单收款单号
     *规则 SKD+年後2位+月日4位+時分秒6位+2位隨機數字1
     * @return String
     */
    public static String getCollectionNumber() {
        StringBuffer collectionNumber = new StringBuffer();
        collectionNumber.append("SKD");
        String year = LocalDate.now().format(DateTimeFormatter.ofPattern("yy"));
        collectionNumber.append(year);
        String month = LocalDate.now().format(DateTimeFormatter.ofPattern("MMdd"));
        collectionNumber.append(month);
        String time = LocalTime.now().format(DateTimeFormatter.ofPattern("HHmmss"));
        collectionNumber.append(time);
        Random random = new Random();
        int number = random.nextInt(90) + 10;
        collectionNumber.append(number+"");
        return collectionNumber.toString();
    }
}
